package cn.edu.swufe.surverpark.struts2.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import cn.edu.swufe.surverpark.model.Page;
import cn.edu.swufe.surverpark.model.Survey;
import cn.edu.swufe.surverpark.model.User;
import cn.edu.swufe.surverpark.struts2.UserAware;
import cn.edu.swufe.surverpark.struts2.service.SurveyService;

/**
 *@author 陈龙 E-mail:529914446@qq.com
 *@version创建时间:2015年5月1日下午3:56:50
 * 移动/复制页面Action
 */
@Controller
@Scope("prototype")
public class MoveOrCopyPageAction extends BaseAction<Page> implements UserAware{

	/**
	 * 移动/复制页面Action
	 */
	private static final long serialVersionUID = -7055375082509658122L;

	private Integer srcPid;
	@Resource
	private SurveyService surveyService;
	private List<Survey> mySurveys;
	private Integer sid;
	private Integer pos;
	private Integer targPid;
	
	public String toSelectTargetPage(){
		this.mySurveys = surveyService.getSurveyWithPages(user);
		return "moveOrCopyPageListPage";
	}

	public Integer getSrcPid() {
		return srcPid;
	}

	public void setSrcPid(Integer srcPid) {
		this.srcPid = srcPid;
	}
	private User user;
	@Override
	public void setUser(User user) {
		// TODO Auto-generated method stub
		this.user = user;
	}

	public List<Survey> getMySurveys() {
		return mySurveys;
	}

	public void setMySurveys(List<Survey> mySurveys) {
		this.mySurveys = mySurveys;
	}
	
	public String doMoveOrCopyPage(){
		surveyService.moveOrCopyPage(srcPid, targPid, pos);
		return "designSurveyAction";
	}

	public Integer getSid() {
		return sid;
	}

	public void setSid(Integer sid) {
		this.sid = sid;
	}

	public Integer getPos() {
		return pos;
	}

	public void setPos(Integer pos) {
		this.pos = pos;
	}

	public Integer getTargPid() {
		return targPid;
	}

	public void setTargPid(Integer targPid) {
		this.targPid = targPid;
	}
	
}

